<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">

<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" th:href="@{/res/css/amazeui.min.css}" />
    <link rel="stylesheet" th:href="@{/res/css/admin.css}" />
    <script th:src="@{/js/jquery-1.11.3.min.js}"></script>
    <script th:src="@{/myplugs/js/plugs.js}"></script>
</head>

<style>
    .block{
        width: 400px;
        display: block;
        margin:30px 0;
    }
    .center{
        text-align: center;
    }
    label {
        display: inline-block;
        width: 100px;
        text-align: right;
    }
    input{
        vertical-align: top;
    }
    form{
        position:relative;
        left:35%;
        margin-top: 8%;
    }
    select{
        width: 180px;
    }
    #pay{
        margin-right: 4%;
    }
</style>

<body>
<div class="admin-content-body">
    <div class="am-cf am-padding am-padding-bottom-0">
        <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">订单支付>>添加地址</strong><small></small></div>
    </div>

    <hr>

    <form class="">
        <fieldset>
            <div class="block">
                <label for="country">国&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;家:</label>
                <input type="text" class="" id="country">
            </div>

            <div class="block">
                <label for="province">省&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;份:</label>
                <input type="text" class="" id="province">
            </div>

            <div class="block">
                <label for="city">城&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;市:</label>
                <input type="text" class="" id="city">
            </div>

            <div class="block">
                <label for="details">详细地址:</label>
                <input type="text" class="" id="details">
            </div>

            <div class="block center">
                <input type="button" id="pay" class="am-btn am-btn-primary am-round" value="确认支付" />
            </div>
        </fieldset>
    </form>
</div>
</body>


<script>
    var result=new Object();
    result=getParameter();
    var oid=result["oid"];
    var bvo_id=result["bid"];
    var totalMoney=result["totalMoney"];
    var mvo_id=result["mid"];

    /*获取URL*/
    function getParameter(){
        var url = location.search;
        var theRequest = new Object();
        if(url.indexOf("?") != -1){
            var str = url.substr(1);
            strs = str.split("&");
            for(var i = 0; i <strs.length; i++){
                theRequest[strs[i].split("=")[0]] = decodeURIComponent(strs[i].split("=")[1]);
            }
        }
        return theRequest;
    };


    $("#pay").click(function(){
        var country = $("#country").val();
        var province = $("#province").val();
        var city = $("#city").val();
        var details = $("#details").val();
        $.ajax({
            type: "POST",
            url: "/order/orderPay",
            dataType: "text",
            data:{orderId:oid, country:country, province:province, city:city, details:details, bid:bvo_id, totalMoney:totalMoney, mid:mvo_id},
            success:function (data) {
                alert(data);
                url="/myOrder?uid="+uid;
                window.location.href=url;
                window.event.returnValue=false;
            },
            error:function (data) {
                alert(data);
            }
        })
    })
</script>
</html>
